import router from '../router/index.js' // 导入Vue Router实例
// 测试一下git
// 全局前置守卫
router.beforeEach((to, from, next) => {
  // 检查本地存储中是否存在username
  const username = window.sessionStorage.getItem('username')
  if (to.path !== '/login' && !username) {
    next('/login')
  } else {
    next() // 否则正常放行
  }
})